def determine_member_level(consumption: float, points: int) -> str:
    """根据消费金额和积分判定会员等级"""
    if consumption >= 1000 and points >= 10000:
        return "钻石会员"
    elif 500 <= consumption < 1000 and 5000 <= points < 10000:
        return "白金会员"
    elif 200 <= consumption < 500 and 2000 <= points < 5000:
        return "黄金会员"
    elif 100 <= consumption < 200 and 1000 <= points < 2000:
        return "白银会员"
    elif 500 <= points < 1000:
        return "青铜会员"
    elif points < 500:
        return "普通会员"
    else:
        return "普通会员"


def main():
    print("="*40)
    print("        会员等级评定系统")
    print("="*40)
    
    try:  # try块必须有对应的except或finally
        consumption = float(input("请输入用户消费金额(元)："))
        points = int(input("请输入用户积分(分)："))
        
        if consumption < 0 or points < 0:
            print("❌ 错误：消费金额和积分不能为负数！")
            return
        
        level = determine_member_level(consumption, points)
        
        print("\n" + "="*40)
        print(f"  消费金额：{consumption:.2f}元")
        print(f"  积    分：{points}分")
        print(f"  会员等级：{level}")
        print("="*40)
    
    except ValueError:  # 捕获输入非数字的错误
        print("❌ 错误：请输入有效的数字（金额为小数，积分为整数）！")
    except Exception as e:  # 捕获其他意外错误
        print(f"❌ 发生未知错误：{str(e)}")


if __name__ == "__main__":
    main()